package com.lanlengran.plugintest

import android.content.Context
import android.content.ContextWrapper
import android.content.res.Resources
import android.content.res.Resources.Theme

open class PluginApplicationContext(base: Context?) : ContextWrapper(base) {
    var mResources: Resources? = null
    var mClassLoader: ClassLoader? = null
    override fun getResources(): Resources {
        mResources?.let {
            return it
        }
        return super.getResources()
    }

    override fun getTheme(): Resources.Theme? {
        return mResources!!.newTheme()
    }

    override fun getClassLoader(): ClassLoader {
        mClassLoader?.let {
            return it
        }
        return super.getClassLoader()

    }
}